#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#

# -*- mode: python; -*-
# services directory

import platform
if platform.system() == 'Darwin':
    Return()

Import('AgentEnv')
env = AgentEnv.Clone()

except_env = env.Clone()
cflags = except_env['CCFLAGS']
if '-fno-exceptions' in cflags:
   cflags.remove('-fno-exceptions')
except_env.Replace(CCFLAGS=cflags)

SandeshGenFiles = env.SandeshGenCpp('services.sandesh')
SandeshGenSrcs = env.ExtractCpp(SandeshGenFiles)
sandesh_objs = AgentEnv.BuildExceptionCppObj(env, SandeshGenSrcs)

if platform.system() == 'Windows':
    platform_dependent = 'windows/default_dns_list_builder.cc'
else:
    platform_dependent = 'nix/default_dns_list_builder.cc'

libservices = env.Library('agent_services',
                     sandesh_objs +
                     [
                      'arp_entry.cc',
                      'arp_handler.cc',
                      'arp_proto.cc',
                      'bfd_handler.cc',
                      'bfd_proto.cc',
                      'dhcp_handler_base.cc',
                      'dhcp_handler.cc',
                      except_env.Object('dhcp_lease_db.cc'),
                      except_env.Object('dhcp_proto.cc'),
                      'dhcpv6_handler.cc',
                      'dhcpv6_proto.cc',
                      'dns_handler.cc',
                      'dns_proto.cc',
                      'icmp_handler.cc',
                      'icmp_proto.cc',
                      'icmp_error_handler.cc',
                      'icmp_error_proto.cc',
                      'icmpv6_handler.cc',
                      'icmpv6_proto.cc',
                      'icmpv6_error_handler.cc',
                      'icmpv6_error_proto.cc',
                      'igmp_handler.cc',
                      'igmp_proto.cc',
                      'metadata_proxy.cc',
                      'services_init.cc',
                      'services_sandesh.cc',
                      platform_dependent,
                      ])

env.SConscript('test/SConscript', exports='AgentEnv', duplicate = 0)

subdirs = [
    'multicast',
    ]

for dir in subdirs:
    env.SConscript(dir + '/SConscript', exports='AgentEnv',
                   duplicate=0)
